<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const o1 = {}; //空对象：没有属性的对象
      const o2 = { a: 1 };

      function isEmpty(obj) {
        for (let k in obj) {
          return false;
        }
        return true;
      }
      // 检测一个对象是不是空对象，是返回ture反之false
      console.log(isEmpty(o1)); //true
      console.log(isEmpty(o2)); //false
    </script>
  </body>
</html>
